package com.fzj.example.socket.tcp.nonblock.bio;

import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;

/**
 * ClassName: BioClient
 * date: 2019/11/18 11:33
 * Description:
 * @author fanzj@bonree.com
 * @since JDK 1.8
 */
public class BioClient  {

    static HandlerExecutorPool handlerExecutorPool=new HandlerExecutorPool(50,1000);

    public static void main(String[] args) {
        Runnable runnable=()->{
            try {
                Socket socket=new Socket(InetAddress.getByName(BioServer.ADDRESS),BioServer.PORT);
                handlerExecutorPool.execute(new SocketHandler("client",handlerExecutorPool,socket));
            } catch (IOException e) {
                e.printStackTrace();
            }
        };
        handlerExecutorPool.execute(runnable);
    }
}
